<!--
 * @description  : 市管-日计划终止审批
 * @descriptionDetail: 市管-日计划终止审批
 * @copyright    : 浙江烟草
 * @author       : sy
 * @create       : 2022-09-07 15:57:44
-->
<template>
  <view class="page">
    <!-- #ifdef H5-ONLY -->
    <theme-navbar :is-white="false" :title="navTitle" :custom-back="goBack" style="z-index: 99999"></theme-navbar>
    <!-- #endif -->
    <view class="content">
      <u-form :model="dataForm" label-position="top" :rules="rules" :errorType="errorType" ref="uForm">
        <u-form-item label="审批意见">
          <u-input type="textarea" height="100" :auto-height="true" placeholder="请输入" v-model="dataForm.approvalContent" />
        </u-form-item>
      </u-form>
    </view>
    <view class="submit-btns btn-other-cls">
      <u-button plain class="del" type="primary" @click="approvalBtn(0)">
        驳回
      </u-button>
      <u-button class="mit" type="primary" @click="approvalBtn(1)">
        同意 
      </u-button>
    </view>
  </view>
</template>

<script>
import checkService from "@/service/check/check.service";
export default {
  components: {
  },
  data() {
    return {
      dataForm: {
        approvalContent:'',
      }, 
      rules: {
        
      },
      errorType: ["message",],
      isTrue: true,
      border: false,
    };
  },
  onReady() {
    this.$refs.uForm.setRules(this.rules);
  },
  // 加载初始周期方法
  onLoad() {
    let opt = this.getRouteParam();
    this.dataForm.busUuid = opt.dayUuid;
    this.dataForm.applyUuid = opt.applyUuid;
  },
  methods: {  
    // 日计划终止审批接口
    approvalBtn(type) {    
      this.dataForm.approvalResult = type;
      this.$u.loading("日计划终止审批中...");
      checkService
        .updateDayPlanTerminationAudit(this.dataForm)
        .then((res) => {
          this.$u.hideLoading();
          if (res.success) {
            this.$u.toast(res.msg);
            // this.$u.route('/pages/check/planStopApprovalList');
            this.backPrev({paramKey:'refresh', param: true,});
          } else {
            this.$u.toast("终止审批失败！");
          }
        })
        .catch((err) => {
          this.$u.hideLoading();
          this.$u.toast(err);
        });
      
    },
  },
};
</script>

<style lang="scss" scoped>
.page{
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	padding: 0;
	.content {
      padding: 4rpx 34rpx;
	}
}
// 页面底部按钮样式
.submit-btns {
  display: flex;
  position: fixed;
  bottom: 40rpx;
  padding-left: 40rpx;
  padding-right: 40rpx;
  width: 100%;
  text-align: center;
  z-index: 999;
  .del {
    flex: 1;
  }
  .mit {
    flex: 1;
    margin-left: 40rpx;
  }
}
.btn-other-cls{
  padding-top: 20rpx;
  position: fixed;
  bottom: 0;
  padding-bottom: 20rpx;
  background-color: white;
  border-top: 1px solid $u-border-color;
}
</style>
